<template>
<div>
  {{title}}
  <el-table  border v-loading="loading" :data="tableList"  v-show="showSearch" >
<!--    <el-table-column type="selection" width="55" align="center" />-->
<!--    <el-table-column label="id" align="center" prop="id" />-->
    <el-table-column label="选手名字" align="center" prop="name" />
    <el-table-column label="国籍" align="center" prop="country" />
    <el-table-column label="所在赛区" align="center" prop="locatedArea" >
      <template slot-scope="scope">
        {{scope.row.locatedArea == '1' ? '北京赛区':scope.row.locatedArea == '2' ? '北京延庆赛区':scope.row.locatedArea == '3' ? '张家口赛区':'--'  }}
      </template>
    </el-table-column>
    <el-table-column label="比赛场地" align="center" prop="competitionVenue" :formatter="formatterCompetitionVenue" />
    <el-table-column label="参与项目名称" align="center" prop="pationProjectName" :formatter="projectNameFormatter"/>
    <el-table-column label="项目种类" align="center" prop="pationProjectType" >
      <template slot-scope="scope">
        {{scope.row.pationProjectType == '1' ? '单人赛':scope.row.pationProjectType == '2' ? '双人赛':scope.row.pationProjectType == '3' ?'团体赛':'--' }}
      </template>
    </el-table-column>
    <el-table-column label="得分" align="center" prop="score" />
    <el-table-column label="个人名次" align="center" prop="individualRanking" />
    <el-table-column label="奖牌" align="center" prop="ranking" >
      <template slot-scope="scope">
        <div v-if="scope.row.individualRanking == 2">
          <img style="width: 30px;height: 44px" src="https://inews.gtimg.com/newsapp_bt/0/1231113333499_5413/0">
        </div>
        <div v-if="scope.row.individualRanking == 1">
          <img style="width: 30px;height: 44px" src="https://inews.gtimg.com/newsapp_bt/0/1231112549302_5173/0">
        </div>
        <div v-if="scope.row.individualRanking == 3">
          <img style="width: 30px;height: 44px" src="https://inews.gtimg.com/newsapp_bt/0/1231113331290_3204/0">
        </div>
      </template>
    </el-table-column>

  </el-table>

</div>
</template>

<script>
import { listTable } from "@/api/system/table";

export default {
  name: "checkPersonalGrades",
  data(){
    return{
      loading:false,
      // 选手成绩录入表格数据
      tableList: [],
      queryParams:{},
      showSearch:true,
      tilte: null
    }
  },
  created(){
    this.getList()
  },
  methods:{
    //比赛场地
    formatterCompetitionVenue(row,cloumn){
      switch(row.competitionVenue){
        case '1':
          return '首都体育馆';
          break;
        case '2':
          return '国家速滑馆';
          break;
        case '3':
          return '国家体育馆';
          break;
        case '4':
          return '五棵松体育中心';
          break;
        case '5':
          return '国家游泳中心';
          break;
        case '6':
          return '首钢滑雪大跳台中心';
          break;
        case '7':
          return '国家雪车雪橇中心';
          break;
        case '8':
          return '国家高山滑雪中心';
          break;
        case '9':
          return '云顶滑雪公园';
          break;
        case '10':
          return '国家跳台滑雪中心';
          break;
        case '11':
          return '国家越野滑雪中心';
          break;
        case '12':
          return '国家冬季两项中心';
          break;
        default:
          return '未知';
      }
    },
    //项目名称
    projectNameFormatter(row,cloumn){
      switch(row.pationProjectName){
        case '1':
          return '短道速滑';
          break;
        case '2':
          return '速度滑冰';
          break;
        case '3':
          return '花样滑冰';
          break;
        case '4':
          return '冰球';
          break;
        case '5':
          return '冰壶';
          break;
        case '6':
          return '雪车';
          break;
        case '7':
          return '钢架雪车';
          break;
        case '8':
          return '雪橇';
          break;
        case '9':
          return '冬季两项';
          break;
        case '10':
          return '高山滑雪';
          break;
        case '11':
          return '自由式滑雪';
          break;
        case '12':
          return '单板滑雪';
          break;
        case '13':
          return '跳台滑雪';
          break;
        case '14':
          return '越野滑雪';
          break;
        case '15':
          return '北欧两项';
          break;
        default:
          return '未知';
      }
    },
    /** 查询选手成绩录入列表 */
    getList() {
      this.queryParams.createUsername = this.$store.state.user.name
      listTable(this.queryParams).then(response => {
        this.tableList = response.rows;
        // this.total = response.total;
        if(this.tableList.length == 0) {
          this.showSearch = false
          this.title = '成绩暂未录入，请等待'
        }
        this.loading = false;
      });
    },
  }
}
</script>

<style scoped>

</style>
